package cn.bdqn.mall.order.dao;

import cn.bdqn.mall.pojo.Order;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class OrderDaoImpl implements OrderDao {
    @Resource
    private JdbcTemplate jdbcTemplate;

    public int save(Order order) {
        String sql = "insert into order(order_no,user_id,order_date,cost,status) values(?,?,?,?,?)";
        return jdbcTemplate.update(sql,
                order.getOrderNo(),
                order.getUserId(),
                order.getOrderDate(),
                order.getCost(),
                order.getStatus());
    }
}
